package com.minelx.sqlstructures.statements;

import java.util.HashMap;
import java.util.Map;

public class InsertStatement {
	private static final String COMMA = ", ";

	private final String tableName;

	private final Map<String, String> values;

	public InsertStatement(String tableName) {
		this.tableName = tableName;
		values = new HashMap<>();
	}

	public void put(String key, String value) {
		values.put(key, value);
	}

	public String toSql() {
		return "INSERT INTO " +
				tableName +
				" (" +
				String.join(COMMA, values.keySet()) +
				") " +
				"VALUES (" +
				String.join(COMMA, values.values()) +
				");";
	}
}
